﻿using HB.MVVM;
using LiveCharts.Geared;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace MyDemoDll
{
    public class VMMainWindow : ViewModelBase<VMMainWindow>
    {
        public GearedValues<double> chartdata { get; set; } = new GearedValues<double>();

        TriggerTimer timer = new TriggerTimer();
        Random r = new Random();
        public ICommand cmdrun => GetCommand(() =>
        {
            chartdata.Clear();
            timer.Start(30, (t, i) =>
            {
                chartdata.Add(DateTime.Now.Second + r.Next(10));
            });

        });
        public ICommand cmdstop => GetCommand(() =>
        {

            timer.Stop();
        });
    }
}
